<!DOCTYPE html>
<%@ page pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>登录</title>
    <link href=
          <c:url value="/asset/template/css/login.css"/> type="text/css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href=<c:url value="/asset/template/css/font-awesome.css"/>>
    <link rel="stylesheet" href=
    <c:url value="/asset/template/css/signin.css"/> type="text/css" media="screen">
    <link href=
          <c:url value="/asset/template/css/googlefont.css"/> rel="stylesheet" type="text/css">

    <script src=<c:url value="/asset/lib/jquery-1.11.1/jquery.js"/>></script>
    <script src=<c:url value="/asset/lib/jquery-form/jquery.form.js"/>></script>

    <script src=<c:url value="/asset/js/common/systemCommon.js"/>></script>

    <style>
        .noticeAll {
            background-color: #f2dede;
            border-color: #eed3d7;
            color: #b94a48;
            margin-bottom: 20px;
            padding: 10px;
            text-align: center;
            display: none;

        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#submitlogin").click(function () {
                var username = $("#username").val();
                var password = $("#password").val();
                var code = $("#code").val();
                login(username, password, code);
            });
        });
        function changeImg() {

            var imgSrc = $("#imgObj");
            var src = imgSrc.attr("src");
            imgSrc.attr("src", chgUrl(src));

        }
        //时间戳
        //为了使每次生成图片不一致，即不让浏览器读缓存，所以需要加上时间戳
        function chgUrl(url) {
            var timestamp = (new Date()).valueOf();
            url = url.substring(0, 17);
            if ((url.indexOf("&") >= 0)) {
                url = url + "×tamp=" + timestamp;
            } else {
                url = url + "?timestamp=" + timestamp;
            }
            return url;
        }


        //登录
        function login(username, password, code) {
            var url = urlRootContext + "/loginSubmit"; //请求的网址
            var reqParams = {'username': username, 'password': password, 'code': code};//请求数据
            $.ajax({
                type: "POST",
                url: url,
                data: reqParams,
                async: false,
                dataType: "json",
                success: function (data) {
                    var code = data.code;
                    var msg = data.msg;
                    if (code == "1") {
                        var isCanInfoFrontFlag = data.isCanInfoFrontFlag;
                        if (isCanInfoFrontFlag) {
                            window.location.href = urlRootContext + "/main/homePage";
                        }
                        else {
                            window.location.href = urlRootContext + "/system/user/userRegister";
                        }
                    }
                    if (code == "2") {
                        changeImg();
                        $("#message_info").html(msg);
                    }
                },
                error: function (e) {
                    alert("跳转失败:" + e);
                }
            });

        }

    </script>
</head>
<body>
<div class="top clearfix">
    <div class="topBox wrap">
        <div class="logo">
            <img src='<c:url value="/asset/template/img/asap-login.png"/>' class="pngfix">
        </div>
        <div class="intro" style="color:#666666;font-size:18px;padding-top:22px">用户画像营销系统</div>
        <!-- 产品logo -->
    </div>

</div>
<div style="background-image: url(&quot;asset/template/img/banner2.jpg&quot;);" class="loginMain">
    <script src=
            <c:url value="/asset/template/js/analytics.js"/> async=""></script>
    <div class="loginWrap wrap">
        <div class="des1">
        </div>
        <!--<div class="des"></div>-->
        <div class="loginBox">
            <div class="box_title" style="text-align:center; width:470px"><span style="color:white">“实时覆盖超过30000家网络媒体，实时展示广告”<span></span></span>
            </div>
            <div class="box" style="height: 350px;">
                <h6>登录</h6>
                <form class="form" method="post">
                    <div class="row"><input class="text" placeholder="账号" id="username" name="username" type="text">
                    </div>
                    <div class="row"><input class="text" placeholder="密码" id="password" name="password" type="password">
                    </div>
                    <div class="row">
                        <input class="text textSort" placeholder="输入验证码" name="code" type="text" id="code">
                        <span id="change_yanzhengma" class="coder"><img id="imgObj" src=<c:url value="code"/>></span>
                        <input id="ref" value="" type="hidden">
                        <a class="coderBtn" onclick="changeImg()">换一张</a>
                    </div>
                    <div class="row2">
                        <a href="forgotPwd" class="forgot">忘记密码?</a>
                        <!--<label>
                            <input class="checkbox" id="remember" type="checkbox">
                        记住密码</label>-->
                    </div>
                    <p id="message_info"></p>
                    <div class="btnRow">
                        <input id="submitlogin" class="btn btnLogin" value="登录"
                               type="button">
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="foot wrap">
    <p>Copyright 2016 Dollar Data Mining Co., Ltd. All Rights Reserved 沪ICP备88888888号</p><!-- 联系我们 -->
</div>


<script src=<c:url value="/asset/template/js/jquery.js"/>></script>
<script src=<c:url value="/asset/template/js/develop.js"/>></script>
<script src=<c:url value="/asset/template/js/ui_login.js"/>></script>

<script>
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
        a = s.createElement(o),
            m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-50341326-2', 'ad7.com');
    ga('set', '&uid', ''); // Set the user ID using signed-in user_id.
    ga('send', 'pageview');

</script>
<script type="text/javascript">
    //回车触发button事件
    document.onkeydown = function mykeyDown(e) {
        //compatible IE and firefox because there is not event in firefox
        e = e || event;
        if (e.keyCode == 13) {
            document.getElementById('submitlogin').click();
        }
        return;
    }

    $(document).ready(function () {
        var r_email = "";
        var r_company = "";
        var r_uname = "";
        var r_mobile = "";

        $('#ad_email_name2').val(r_email);
        $('#ad_company_name2').val(r_company);
        $('#ad_name2').val(r_uname);
        $('#ad_tel2').val(r_mobile);

        //通知弹出
        //setTimeout("openNotice()", 1000);
        //setTimeout("closeNotice()", 20000);


    });

    function openNotice() {
        $('.noticeAll').slideToggle(800);
    }
    function closeNotice() {
        $('.noticeAll').fadeOut(800);
    }

</script>

</body><!-- scripts --></html>